package br.com.rafsoft.mapaentrega.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;

public class MainWidget extends Composite {

	private static MainWidgetUiBinder uiBinder = GWT
			.create(MainWidgetUiBinder.class);

	interface MainWidgetUiBinder extends UiBinder<Widget, MainWidget> {
	}
	
	@UiField
	AbsolutePanel panel;
	
	UserWidget userWidget = new UserWidget();
	TaskWidget taskWidget = new TaskWidget();
	MessageWidget messageWidget = new MessageWidget();

	public MainWidget() {
		initWidget(uiBinder.createAndBindUi(this));
	}




	@UiHandler("usersButton")
	void onUsersButtonClick(ClickEvent event) {
		panel.clear();
		panel.add(userWidget);
	}
	@UiHandler("tasksButton")
	void onTasksButtonClick(ClickEvent event) {
		panel.clear();
		panel.add(taskWidget);
	}
	@UiHandler("messagesButton")
	void onMessagesButtonClick(ClickEvent event) {
		panel.clear();
		panel.add(messageWidget);
	}
}
